<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdjustmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('adjustments', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedInteger('order_id')->nullable()->index();
            $table->unsignedInteger('order_item_id')->nullable()->index();
            $table->string('type')->comment('调整的类型  freight 运费抵扣 discount 优惠抵扣 integral 积分抵扣');
            $table->string('label')->comment('结合type决定名称');
            $table->string('origin_code')->comment('结合label决定');
            $table->boolean('included')->comment('是否会影响最终订单需要支付的价格');
            $table->integer('amount')->comment('最终影响的价格');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('adjustments');
    }
}
